package crazy.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class ClassTest
{
	private ClassTest()
	{}
	
	public ClassTest(String name)
	{
		System.out.println("name");
	}
	
	public void info()
	{
		System.out.println("info");
	}
	
	public void info(String str)
	{
		System.out.println("Info--Str");
	}
	
	class Inner
	{
		
	}
	
	public static void main(String[] args) throws Exception
	{
		Class<ClassTest> clazz = ClassTest.class;
		Constructor[] ctors = clazz.getDeclaredConstructors();
		for (Constructor c : ctors)
		{
			System.out.println(c);
		}
		
		Constructor[] publicCtors = clazz.getConstructors();
		for (Constructor c : publicCtors)
		{
			System.out.println(c);
		}
		
		Method[] mtds = clazz.getMethods();
		for (Method md : mtds)
		{
			System.out.println(md);
		}
		System.out.println(clazz.getMethod("info", String.class));
		
		Class<?>[] inners = clazz.getDeclaredClasses();
		for (Class c : inners)
		{
			System.out.println(c);
		}
		
		Class inClazz = Class.forName("crazy.reflect.ClassTest$Inner");
		System.out.println(inClazz.getDeclaredClasses());
		System.out.println(clazz.getPackage());
	}
}
